<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var timer;
        var timer2;
        function go(){
            console.log("welcome to 南京");
        }
        function show(){
            timer=window.setTimeout(go,1000);//一秒后执行go函数
           
        }

        function show2(){
            setTimeout(function(){
                console.log("熊");
            },1000);
        }
        function clear1(){
            window.clearTimeout(timer);//清除一次性计时器
        }
        function go2(){
            console.log("我来自南京");
        }
        function show3(){
            
            timer2=setInterval(go2,1000);//每隔一秒执行go2函数
            console.log(timer2);
        }
        function clear2(){
            clearInterval(timer2);//清除周期性计时器
        }
    </script>
</head>
<body>
    <input type="button" value="一次性计时器" onclick="show()">
    <input type="button" value="一次性计时器" onclick="show2()">
    <input type="button" value="清除一次性计时器" onclick="clear1()">
    <input type="button" value="周期性计时器" onclick="show3()">
    <input type="button" value="清除周期性计时器" onclick="clear2()">

</body>
</html>